/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.startup.musicstore.services.Impl;

import com.startup.musicstore.model.Customer;
import com.startup.musicstore.model.CustomerAddress;
import com.startup.musicstore.services.CustomerService;
import com.startup.musicstore.services.crud.CustomerCrudService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 *
 * @author aljay19
 */
@Service("customerService")
@Transactional
public class CustomerServiceImpl implements CustomerService {
    
    @Autowired
    private CustomerCrudService customerCrudService;

    @Override
    public CustomerAddress findCustomerAddress(Long custID) {
        
        Customer customer = customerCrudService.findById(custID);
        CustomerAddress address = customer.getCustomerAddress();
        
        return address;
    }

    @Override
    public String findCustomerCellNumber(Long custID) {
        
        Customer customer = customerCrudService.findById(custID);
        String cellNumber = customer.getContact().getCellNumber();
        
        return cellNumber;
    }
    


}
